#!/usr/bin/env python
# -*-coding:UTF-8 -*-
'''
@Project ：19-xpath站长素材.py
@File：35-下载图片普通.py
@Author ：文非
@Date：2021/3/1511:03
@Require：
'''

import aiohttp
import asyncio
async def download_pic(session, url):
    print("开始下载...............")
    async with session.get(url, verify_ssl=False) as response:
        content = await  response.content.read()
        file_name = url.rsplit('_')[-1]
        with open(file_name,"wb")as fp:
            fp.write(content)
        print("下载完成",url)

async def main():
    async with aiohttp.ClientSession() as session:
        url_list = [

        ]
        tasks = [asyncio.create_task(download_pic(session, url)) for url in url_list]
        await asyncio.wait(tasks)

if __name__ == "__main__":
    asyncio.run(main())
